unit uPlusManager;

interface

uses
  Classes, uiMemStarAPI, Contnrs;

type
  TMemStarPlus = class(TInterfacedPersistent, IMemStarPlus)
  private
    FSupport:string;
    FTitle:string;
  protected
    function GetSupport: string; stdcall;
    function GetTitle: string; stdcall;
    procedure SetSupport(const Value: string); stdcall;
    procedure SetTitle(const Value: string); stdcall;
  public
    property Support: string read GetSupport write SetSupport;
    property Title: string read GetTitle write SetTitle;
  end;
  

  TPlusList = class(TInterfacedPersistent, IMemStarPlusList)
  private
    FItems: TObjectList;
    function GetCount: Integer;
    function GetItems(Index: Integer): IMemStarPlus;stdcall;
  public
    constructor Create;
    destructor Destroy; override;

    procedure Clear;
    function Add: Integer; stdcall;

    property Count: Integer read GetCount;
    property Items[Index: Integer]: IMemStarPlus read GetItems; default;
  end;

implementation

function TPlusList.Add: Integer;
var
  cItem:TMemStarPlus;
begin
  cItem := TMemStarPlus.Create;
  Result := FItems.Add(cItem);
end;

procedure TPlusList.Clear;
begin
  FItems.Clear;
end;

constructor TPlusList.Create;
begin
  inherited Create;
  FItems := TObjectList.Create;
end;

destructor TPlusList.Destroy;
begin
  Clear;
  FItems.Free;
  inherited Destroy;
end;

function TPlusList.GetCount: Integer;
begin
  Result := FItems.Count;
end;

function TPlusList.GetItems(Index: Integer): IMemStarPlus;
begin
  Result := TMemStarPlus(FItems[Index]);
end;

{ TMemStarPlus }

function TMemStarPlus.GetSupport: string;
begin
  Result := FSupport;
end;

function TMemStarPlus.GetTitle: string;
begin
  Result := FTitle;
end;

procedure TMemStarPlus.SetSupport(const Value: string);
begin
  FSupport := Value;
end;

procedure TMemStarPlus.SetTitle(const Value: string);
begin
  FTitle := Value;
end;

end.
